package com.example.yingjiguanli_demo.Strategy.user;

import com.example.yingjiguanli_demo.pojo.LoginRequest;
import com.example.yingjiguanli_demo.pojo.Users;

import static com.example.yingjiguanli_demo.utils.ConstantUtils.STATUS_DISABLED;

/**
 * 用户启用策略
 * 检查用户是否被禁用
 */
public class UserEnabledStrategy implements AuthenticationStrategy {
    @Override
    public boolean authenticate(Users users, LoginRequest loginRequest) {
        return users.getStatus() != STATUS_DISABLED; // 用户状态不为禁用
    }

    @Override
    public String getFailureMessage() {
        return "该用户已被禁用！";
    }
}

